package com.xbao.dao;

import com.xbao.model.ClsRecordCheck;
import com.xbao.model.ClsRecordCheckExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface ClsRecordCheckMapper {
    @SelectProvider(type=ClsRecordCheckSqlProvider.class, method="countByExample")
    int countByExample(ClsRecordCheckExample example);

    @DeleteProvider(type=ClsRecordCheckSqlProvider.class, method="deleteByExample")
    int deleteByExample(ClsRecordCheckExample example);

    @Delete({
        "delete from cls_record_check",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into cls_record_check (cid, rid, ",
        "createtime, checktime, ",
        "comments)",
        "values (#{cid,jdbcType=BIGINT}, #{rid,jdbcType=BIGINT}, ",
        "#{createtime,jdbcType=BIGINT}, #{checktime,jdbcType=BIGINT}, ",
        "#{comments,jdbcType=BIGINT})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(ClsRecordCheck record);

    @InsertProvider(type=ClsRecordCheckSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(ClsRecordCheck record);

    @SelectProvider(type=ClsRecordCheckSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="cid", property="cid", jdbcType=JdbcType.BIGINT),
        @Result(column="rid", property="rid", jdbcType=JdbcType.BIGINT),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="checktime", property="checktime", jdbcType=JdbcType.BIGINT),
        @Result(column="comments", property="comments", jdbcType=JdbcType.BIGINT)
    })
    List<ClsRecordCheck> selectByExample(ClsRecordCheckExample example);

    @Select({
        "select",
        "id, cid, rid, createtime, checktime, comments",
        "from cls_record_check",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="cid", property="cid", jdbcType=JdbcType.BIGINT),
        @Result(column="rid", property="rid", jdbcType=JdbcType.BIGINT),
        @Result(column="createtime", property="createtime", jdbcType=JdbcType.BIGINT),
        @Result(column="checktime", property="checktime", jdbcType=JdbcType.BIGINT),
        @Result(column="comments", property="comments", jdbcType=JdbcType.BIGINT)
    })
    ClsRecordCheck selectByPrimaryKey(Long id);

    @UpdateProvider(type=ClsRecordCheckSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") ClsRecordCheck record, @Param("example") ClsRecordCheckExample example);

    @UpdateProvider(type=ClsRecordCheckSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") ClsRecordCheck record, @Param("example") ClsRecordCheckExample example);

    @UpdateProvider(type=ClsRecordCheckSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ClsRecordCheck record);

    @Update({
        "update cls_record_check",
        "set cid = #{cid,jdbcType=BIGINT},",
          "rid = #{rid,jdbcType=BIGINT},",
          "createtime = #{createtime,jdbcType=BIGINT},",
          "checktime = #{checktime,jdbcType=BIGINT},",
          "comments = #{comments,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(ClsRecordCheck record);
}